﻿namespace Tszy.Unlimited.Base.Common;

/// <summary>
/// 订单号生成器。
/// </summary>
public static class OrderNumberBuilder
{
    /// <summary>
    /// 生成哈希码。
    /// </summary>
    /// <returns></returns>
    public static string BuildByHashCode()
    {
        var orderNumber = DateTime.Now.ToFileTime();

        var lastCode = Guid.NewGuid().ToString().GetHashCode();

        if (lastCode < 0)
        {
            lastCode = -lastCode;
        }

        return (orderNumber.ToString() + lastCode.ToString("0000000"))[..25];
    }
}
